const { defineConfig } = require('@vue/cli-service');
const CopyWebpackPlugin = require('copy-webpack-plugin');

module.exports = defineConfig({
  publicPath: './',
  assetsDir: './static', //放置生成的静态资源
  filenameHashing: true, // 生成的静态资源在它们的文件名中包含了 hash 以便更好的控制缓存
  lintOnSave: false, //设置是否在开发环境下每次保存代码时都启用 eslint验证
  productionSourceMap: false,// 打包时不生成.map文件

  devServer: {
    client: {
      overlay: false,
    },
    proxy: {
      '/api': {
        target: 'http://127.0.0.1:8080',// 后端接口
        changeOrigin: true, // 是否跨域
        pathRewrite: {
          '/api': ''
        }
      }
    }
  },
  transpileDependencies: true,
  lintOnSave: false,
  configureWebpack: {
    plugins: [
      new CopyWebpackPlugin({
        patterns: [
          { from: 'node_modules/@liveqing/liveplayer/dist/component/crossdomain.xml', to: '' },
          { from: 'node_modules/@liveqing/liveplayer/dist/component/liveplayer.swf', to: '' },
          { from: 'node_modules/@liveqing/liveplayer/dist/component/liveplayer-lib.min.js', to: 'js/' }
        ]
      })
    ]
  }
});
